package com.haotian.web.fileupload;


import javax.servlet.http.HttpServletRequest;

/**
 * 文件上传配置类
 * <p>
 * </p>
 * 
 * @author 张昊天 2018年6月27日
 */
public class _FileUploadConfig {

	private HttpServletRequest request;

	// 上传文件存储目录 默认值为null 不设置则直接返回文件集合
	private String UPLOAD_DIRECTORY = null;

	// 上传配置
	private int MEMORY_THRESHOLD = 1024 * 1024 * 3; // 3MB
	private int MAX_FILE_SIZE = 1024 * 1024 * 40; // 40MB
	private int MAX_REQUEST_SIZE = 1024 * 1024 * 50; // 50MB
	
	private String encoding;

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	/**
	 * 上传文件存储目录 默认值为null 不设置则直接返回文件集合
	 * <p>
	 * </p>
	 * 
	 * @param uPLOAD_DIRECTORY
	 */
	public void setUPLOAD_DIRECTORY(String uPLOAD_DIRECTORY) {
		UPLOAD_DIRECTORY = uPLOAD_DIRECTORY;
	}

	/**
	 * 设置内存临界值 - 超过后将产生临时文件并存储于临时目录中 默认值1024*1024*3
	 * <p>
	 * </p>
	 * 
	 * @param mEMORY_THRESHOLD
	 */
	public void setMEMORY_THRESHOLD(int mEMORY_THRESHOLD) {
		MEMORY_THRESHOLD = mEMORY_THRESHOLD;
	}

	/**
	 * 设置最大文件上传值 默认值1024*1024*40
	 * <p>
	 * </p>
	 * 
	 * @param mAX_FILE_SIZE
	 */
	public void setMAX_FILE_SIZE(int mAX_FILE_SIZE) {
		MAX_FILE_SIZE = mAX_FILE_SIZE;
	}

	/**
	 * 设置最大请求值 (包含文件和表单数据)  默认值1024*1024*50
	 * <p>
	 * </p>
	 * 
	 * @param mAX_REQUEST_SIZE
	 */
	public void setMAX_REQUEST_SIZE(int mAX_REQUEST_SIZE) {
		MAX_REQUEST_SIZE = mAX_REQUEST_SIZE;
	}
	
	public void setEncoding(String uEncoding){
		encoding = uEncoding;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public String getUPLOAD_DIRECTORY() {
		return UPLOAD_DIRECTORY;
	}

	public int getMEMORY_THRESHOLD() {
		return MEMORY_THRESHOLD;
	}

	public int getMAX_FILE_SIZE() {
		return MAX_FILE_SIZE;
	}

	public int getMAX_REQUEST_SIZE() {
		return MAX_REQUEST_SIZE;
	}

	public String getEncoding() {
		return encoding;
	}
	
	
	

}
